<?php


namespace app\admin\controller;


use app\admin\model\Adminlog;
use think\Controller;
use think\Db;

class Wanfa extends Systemcontrol
{
    public function index()
    {
        $result=Db::name('wanfa')->where('id','>',0)->select();
        $this->assign ('result',$result);
        return $this->fetch('index');
    }
    public function jlsave(){

        $result=Db::name('wanfa')->where('id','>',0)->select();
        foreach ($result as $k => $v) {
            if(!$_POST['id'.$v['id']]){
                $data['id']=$_POST['id'.$v['id']];//ID
                $data['number']=$_POST['number'.$v['id']];//奖励数字
                $data['multiple']=$_POST['multiple'.$v['id']];//奖励倍数
                $data['state']=$_POST['state'.$v['id']];//勾选状态
                Db::name('wanfa')->where('id',$v['id'])->update($data);
            }


        }
        Adminlog::adminlog('更新奖励设置');
        return $this->index();
    }
}